package main

import (
	"context"
	"fmt"
	"github.com/coreos/etcd/clientv3"
	"time"
)

func main() {
	cli, err := clientv3.New(clientv3.Config{Endpoints: []string{"localhost:2379"},
		DialTimeout: 5 * time.Second,
	})
	if err != nil {
		fmt.Println(err)
	}
	ctx := context.TODO()
	//用于读写etcd的键值对
	kv := clientv3.NewKV(cli)
	deleteResp, _ := kv.Delete(ctx, "/user/zhanglin2")
	//获取版本信息
	fmt.Println("本次的 Revision:", deleteResp.Header.Revision)
}

// delete也会让全局的Revision 加1
